#include "ClientUser.h"

ClientUser::ClientUser()
{
}

ClientUser::~ClientUser()
{
}

void ClientUser::link(BookingClass* i, Holiday* j, Management* k, Mailbox* l)
{
    bc = i;
    hol = j;
    mg = k;
    mb = l;
}

void ClientUser::menu(string username, int clientID)
{
    cout << "Welcome Valued Customer " << username << " !" << endl
            << "==================================================" << endl << endl;

    bool isExit = false;
    do
    {
        cout << "Please select desired option" << endl << endl
                << "1) Make New Booking" << endl
                << "2) Edit or Cancel Existing Booking" << endl
                << "3) View Mailbox" << endl
                << "4) Logout" << endl << endl
                << "Your Option: ";

        int opt;
        cin >> opt;
        cin.clear();
        cin.ignore(INT_MAX, '\n');

        switch (opt)
        {
        case 1: option1(clientID);
            break;
        case 2: option2(clientID);
            break;
        case 3: option3(username);
            break;
        case 4: isExit = true;
            break;
        default: cout << "Enter only 1-4 please." << endl;
            break;
        }
    }
    while (isExit == false);
}

void ClientUser::option1(int clientID)
{
    cout << endl << "You have selected to make a new booking." << endl << endl;
    bc->makeBooking(clientID);
}

void ClientUser::option2(int clientID)
{
    cout << endl << "You have selected to edit or cancel a booking." << endl << endl;
    bc->editAndCancelBooking(clientID);
}

void ClientUser::option3(string username)
{
    cout << endl << "Opening your mailbox." << endl << endl;
    mb->showMail(username);
}